package Internet.Test;

import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.ServerSocket;
import java.net.Socket;

public class Rec {
    public static void main(String[] args) throws IOException {
        ServerSocket ss = new ServerSocket(10000);
        Socket socket = ss.accept();
        InputStream inputStream = socket.getInputStream();
        InputStreamReader isr = new InputStreamReader(inputStream);
        int b;
        while ((b = isr.read()) != -1){
            System.out.print((char) b);
        }

        String str = "有多开心？";
        OutputStream os = socket.getOutputStream();
        os.write(str.getBytes());
        socket.close();
        ss.close();
    }
}
